cmake_minimum_required(VERSION 3.5)
project(test)
# Set C++ standard to C++17
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Set the build type to debug
# set(CMAKE_BUILD_TYPE Debug)
# set(CMAKE_C_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g")
# set(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g")
# find Eigen3
find_package(Eigen3 REQUIRED)
# for my types library
include_directories(include)
file(GLOB_RECURSE SOURCES "src/*.cpp")
file(GLOB_RECURSE H_SOURCE "include/*.hpp")
add_library(my_types SHARED ${SOURCES} ${H_SOURCE})
# find all the cpp files in the src directory

# Add the executable
add_executable(${PROJECT_NAME} main.cpp)

target_link_libraries(${PROJECT_NAME} my_types)
target_link_libraries(${PROJECT_NAME} g2o_core g2o_types_sba g2o_solver_dense g2o_stuff g2o_types_slam3d)
if(CHOLMOD_FOUND)
  target_link_libraries(${PROJECT_NAME} g2o_solver_cholmod)
else()
  target_link_libraries(${PROJECT_NAME} g2o_solver_eigen)
endif()

target_include_directories(${PROJECT_NAME} PRIVATE include
  ${EIGEN3_INCLUDE_DIR}
)
